home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / stomp / stomp2.frm < prev    next >
Text File  |  1995-09-06  |  8KB  |  274 lines

  1. VERSION 2.00
  2. Begin Form FileDlg 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "File"
  5.    ClientHeight    =   4170
  6.    ClientLeft      =   1500
  7.    ClientTop       =   1635
  8.    ClientWidth     =   5790
  9.    ControlBox      =   0   'False
  10.    FontBold        =   -1  'True
  11.    FontItalic      =   0   'False
  12.    FontName        =   "Times New Roman"
  13.    FontSize        =   9
  14.    FontStrikethru  =   0   'False
  15.    FontUnderline   =   0   'False
  16.    Height          =   4575
  17.    Left            =   1440
  18.    LinkMode        =   1  'Source
  19.    LinkTopic       =   "Form1"
  20.    MaxButton       =   0   'False
  21.    MinButton       =   0   'False
  22.    ScaleHeight     =   4170
  23.    ScaleWidth      =   5790
  24.    Top             =   1290
  25.    Width           =   5910
  26.    Begin TextBox FileEdit 
  27.       FontBold        =   -1  'True
  28.       FontItalic      =   0   'False
  29.       FontName        =   "Times New Roman"
  30.       FontSize        =   9
  31.       FontStrikethru  =   0   'False
  32.       FontUnderline   =   0   'False
  33.       Height          =   375
  34.       Left            =   1560
  35.       TabIndex        =   0
  36.       Text            =   "*.*"
  37.       Top             =   240
  38.       Width           =   2790
  39.    End
  40.    Begin CommandButton Ok 
  41.       Caption         =   "OK"
  42.       Default         =   -1  'True
  43.       FontBold        =   0   'False
  44.       FontItalic      =   0   'False
  45.       FontName        =   "Times New Roman"
  46.       FontSize        =   9
  47.       FontStrikethru  =   0   'False
  48.       FontUnderline   =   0   'False
  49.       Height          =   375
  50.       Left            =   4470
  51.       TabIndex        =   2
  52.       Top             =   240
  53.       Width           =   1215
  54.    End
  55.    Begin CommandButton Cancel 
  56.       Cancel          =   -1  'True
  57.       Caption         =   "Cancel"
  58.       FontBold        =   0   'False
  59.       FontItalic      =   0   'False
  60.       FontName        =   "Times New Roman"
  61.       FontSize        =   9
  62.       FontStrikethru  =   0   'False
  63.       FontUnderline   =   0   'False
  64.       Height          =   375
  65.       Left            =   4470
  66.       TabIndex        =   3
  67.       Top             =   660
  68.       Width           =   1215
  69.    End
  70.    Begin FileListBox File1 
  71.       FontBold        =   0   'False
  72.       FontItalic      =   0   'False
  73.       FontName        =   "Times New Roman"
  74.       FontSize        =   9
  75.       FontStrikethru  =   0   'False
  76.       FontUnderline   =   0   'False
  77.       Height          =   2280
  78.       Left            =   315
  79.       TabIndex        =   10
  80.       Top             =   1515
  81.       Width           =   1695
  82.    End
  83.    Begin ListBox DirList 
  84.       FontBold        =   0   'False
  85.       FontItalic      =   0   'False
  86.       FontName        =   "Times New Roman"
  87.       FontSize        =   9
  88.       FontStrikethru  =   0   'False
  89.       FontUnderline   =   0   'False
  90.       Height          =   2280
  91.       Left            =   2400
  92.       TabIndex        =   5
  93.       Top             =   1515
  94.       Width           =   1695
  95.    End
  96.    Begin DirListBox Dir1 
  97.       Height          =   1500
  98.       Left            =   5070
  99.       TabIndex        =   9
  100.       Top             =   2040
  101.       Visible         =   0   'False
  102.       Width           =   2490
  103.    End
  104.    Begin DriveListBox Drive1 
  105.       Height          =   1575
  106.       Left            =   5085
  107.       TabIndex        =   8
  108.       Top             =   3630
  109.       Visible         =   0   'False
  110.       Width           =   2460
  111.    End
  112.    Begin Label Label1 
  113.       Alignment       =   1  'Right Justify
  114.       Caption         =   "File&name:"
  115.       FontBold        =   0   'False
  116.       FontItalic      =   0   'False
  117.       FontName        =   "Times New Roman"
  118.       FontSize        =   9
  119.       FontStrikethru  =   0   'False
  120.       FontUnderline   =   0   'False
  121.       Height          =   255
  122.       Left            =   330
  123.       TabIndex        =   1
  124.       Top             =   315
  125.       Width           =   1080
  126.    End
  127.    Begin Label DirLabel 
  128.       Caption         =   "c:\"
  129.       FontBold        =   0   'False
  130.       FontItalic      =   0   'False
  131.       FontName        =   "Times New Roman"
  132.       FontSize        =   9
  133.       FontStrikethru  =   0   'False
  134.       FontUnderline   =   0   'False
  135.       Height          =   315
  136.       Left            =   345
  137.       TabIndex        =   7
  138.       Top             =   750
  139.       Width           =   5400
  140.    End
  141.    Begin Label Label2 
  142.       Caption         =   "&Files:"
  143.       FontBold        =   0   'False
  144.       FontItalic      =   0   'False
  145.       FontName        =   "Times New Roman"
  146.       FontSize        =   9
  147.       FontStrikethru  =   0   'False
  148.       FontUnderline   =   0   'False
  149.       Height          =   285
  150.       Left            =   330
  151.       TabIndex        =   4
  152.       Top             =   1200
  153.       Width           =   615
  154.    End
  155.    Begin Label Label3 
  156.       Caption         =   "&Directories:"
  157.       FontBold        =   0   'False
  158.       FontItalic      =   0   'False
  159.       FontName        =   "Times New Roman"
  160.       FontSize        =   9
  161.       FontStrikethru  =   0   'False
  162.       FontUnderline   =   0   'False
  163.       Height          =   270
  164.       Left            =   2385
  165.       TabIndex        =   6
  166.       Top             =   1170
  167.       Width           =   1500
  168.    End
  169. End
  170. Sub Cancel_Click ()
  171.     ' if we select Cancel, we can unload the dialog since
  172.     ' we don't need it anymore
  173.     fileedit.text = ""
  174.     Hide
  175. End Sub
  176.  
  177. Sub DirList_DblClick ()
  178.     Const MB_RETRYANDCANCEL = 5
  179.     Const MB_ICONEXCLAMATION = 48
  180.  
  181.     On Local Error GoTo UhOh
  182.  
  183.     ' when you double-click on a directory or drive entry,
  184.     ' check to see if the selected item is a drive; if so,
  185.     ' change the current drive
  186.     If Left$(DirList.text, 2) = "[-" And Len(DirList.text) = 5 Then
  187.         oldDir$ = CurDir$
  188.         ChDrive Mid$(DirList.text, 3, 1)
  189.         A$ = CurDir$    ' check to see if the disk is ready
  190.     ' otherwise, change the current directory
  191.     Else
  192.         ChDir Mid$(DirList.text, 2, Len(DirList.text) - 2)
  193.     End If
  194.  
  195.     On Local Error GoTo 0
  196.  
  197.     Update_List_Boxes
  198.     Exit Sub
  199.  
  200. UhOh:
  201.     If MsgBox("Unable to switch to drive " + Mid$(DirList.text, 3, 1) + ":", MB_RETRYANDCANCEL + MB_ICONEXCLAMATION, "Visual Basic - FileDlg") = 2 Then
  202.     ' if we press Cancel, go back to the previous drive
  203.             ChDrive Left$(oldDir$, 1)
  204.     End If
  205.     
  206.     Resume
  207. End Sub
  208.  
  209. Sub File1_Click ()
  210.     fileedit.text = File1.FileName
  211. End Sub
  212.  
  213. Sub File1_DblClick ()
  214.     fileedit.text = File1.FileName
  215.   ok_click
  216. End Sub
  217.  
  218. Sub Form_GotFocus ()
  219.     Update_List_Boxes
  220. End Sub
  221.  
  222. Sub Form_Load ()
  223.     Update_List_Boxes
  224. End Sub
  225.  
  226. Sub ok_click ()
  227.     If InStr(fileedit.text, "*") Or InStr(fileedit.text, "?") Then
  228.         Update_List_Boxes
  229.     Else
  230.         If which = 1 Then
  231.             form1.text1.text = Trim(fileedit.text)
  232.         Else
  233.             form1.text2.text = Trim(fileedit.text)
  234.         End If
  235.         Unload Me
  236.     End If
  237. End Sub
  238.  
  239. Sub Update_List_Boxes ()
  240.     
  241.     DirLabel.Caption = LCase$(CurDir$)
  242.  
  243.     
  244.     File1.Path = CurDir$
  245.     
  246.  
  247.     File1.Pattern = fileedit.text
  248.     Do While DirList.ListCount
  249.         DirList.RemoveItem 0
  250.     Loop
  251.     
  252.     
  253.     If Right$(CurDir$, 1) <> "\" Then DirList.AddItem "[..]"
  254.     
  255.     Dir1.Path = CurDir$
  256.     For I = 0 To Dir1.ListCount - 1
  257.         A$ = Dir1.List(I)
  258.         For J = Len(A$) To 1 Step -1
  259.             If Mid$(A$, J, 1) = "\" Then
  260.                 A$ = Mid$(A$, J + 1)
  261.                 Exit For
  262.             End If
  263.         Next
  264.  
  265.         
  266.         DirList.AddItem "[" + A$ + "]"
  267.     Next
  268.  
  269.     For I = 0 To Drive1.ListCount - 1
  270.         DirList.AddItem "[-" + Mid$(Drive1.List(I), 1, 1) + "-]"
  271.     Next
  272. End Sub
  273.  
  274.